import 'package:flutter_test/flutter_test.dart';
import 'package:xsdk_flutter/xsdk_flutter.dart';
import 'package:xsdk_flutter/xsdk_flutter_platform_interface.dart';
import 'package:xsdk_flutter/xsdk_flutter_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockXsdkFlutterPlatform
    with MockPlatformInterfaceMixin
    implements XsdkFlutterPlatform {
  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<bool?> hasSDK({required String service, required String provider}) {
    // TODO: implement hasSDK
    throw UnimplementedError();
  }

  @override
  onPush(
      {required EventHandler onRegisterSucceed,
      required EventHandler onNotificationMessageClicked,
      required EventHandler onNotificationMessageArrived}) {
    // TODO: implement onPush
    throw UnimplementedError();
  }

  @override
  Future<String?> initSDK(Map data) {
    // TODO: implement initSDK
    throw UnimplementedError();
  }

  @override
  Future<String?> login(Map data) {
    // TODO: implement login
    throw UnimplementedError();
  }

  @override
  Future<String?> logout(Map data) {
    // TODO: implement logout
    throw UnimplementedError();
  }

  @override
  Future<String?> pay(Map data) {
    // TODO: implement pay
    throw UnimplementedError();
  }

  @override
  Future<String?> postEvent(Map data) {
    // TODO: implement postEvent
    throw UnimplementedError();
  }

  @override
  Future<String?> share(Map data) {
    // TODO: implement share
    throw UnimplementedError();
  }
}

void main() {
  final XsdkFlutterPlatform initialPlatform = XsdkFlutterPlatform.instance;

  test('$MethodChannelXsdkFlutter is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelXsdkFlutter>());
  });

  test('getPlatformVersion', () async {
    XSdk xsdkFlutterPlugin = XSdk();
    MockXsdkFlutterPlatform fakePlatform = MockXsdkFlutterPlatform();
    XsdkFlutterPlatform.instance = fakePlatform;

    expect(await xsdkFlutterPlugin.getPlatformVersion(), '42');
  });
}
